<template>
	<a-layout>
		<a-spin :spinning="spinning">
			<a-layout-header class="header">
				<div class="logo"/>
				<a-menu
						v-model:selectedKeys="menuSelected"
						:style="{ lineHeight: '64px' }"
						mode="horizontal"
						theme="dark"
						@click="menuClickHandler"
				>
					<a-menu-item key="/">人员管理</a-menu-item>
					<a-menu-item key="/dept">机构管理</a-menu-item>
					<a-menu-item key="/notice">设置</a-menu-item>
				</a-menu>
			</a-layout-header>
			<a-layout>
				<a-layout style="padding: 0 24px 24px">
					<a-layout-content
							:style="{ background: '#fff', padding: '24px', margin: 0, minHeight: 'calc(100vh - 106px)' }"
					>
						<router-view></router-view>
					</a-layout-content>
				</a-layout>
			</a-layout>
		</a-spin>
	</a-layout>
</template>
<script setup>
import { doc_to_pdf } from "@/api/fetch";
import { ipcApiRoute } from "@/api/main";
import { ipc } from "@/utils/ipcRenderer";
import { onMounted, ref } from 'vue';
import { useRouter } from "vue-router";

const router = useRouter();
const spinning = ref(true)

const menuSelected = ref(['/']);
onMounted(async () => {
	document.getElementById('loadingPage').remove()

	await ipc.invoke(ipcApiRoute.startPython); // 启动python服务 
	spinning.value = false
});

// 路由跳转
function menuClickHandler (v) {
	router.push(v.key)
}
</script>
<style scoped>
#components-layout-demo-top-side-2 .logo {
	float: left;
	width: 120px;
	height: 31px;
	margin: 16px 24px 16px 0;
	background: rgba(255, 255, 255, 0.3);
}

.ant-row-rtl #components-layout-demo-top-side-2 .logo {
	float: right;
	margin: 16px 0 16px 24px;
}

.site-layout-background {
	background: #fff;
}
</style>
